<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@page import="java.util.HashMap"%>
<%@ include file="/WEB-INF/views/tag.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>修改用户密码信息页面</title>
<LINK rel="stylesheet" type="text/css" href="${baseurl}js/easyui/styles/default.css">
<%@ include file="/WEB-INF/views/common_css.jsp"%>
<%@ include file="/WEB-INF/views/common_js.jsp"%>

<script type="text/javascript">
	/* 表单异步提交 */
	 $(function(){
		 /* 自定义校验 */
		 $.extend($.fn.validatebox.defaults.rules, {
		    pwdLength: {
		        validator: function(value, param){
		            return (value.length >= param[0])&&(value.length <= param[1])&&($('.easyui-validatebox').val());
		        },
		        message: '请输入6~12位密码'
		    },
		    
		    rpwdLength: {
		        validator: function(value, param){
		            return $('#pwd').val()==value;
		        },
		        message: '请保持两次输入一致'
		    }
		});

		 /* 表单校验 */
		 $('.easyui-validatebox').validatebox({
			    required:true
		 });
		 
		//调用表单插件的'submit'方法提交
		$("#submit").click(function(){
			 $('#itemForm').form('submit', {
			     url:"${pageContext.request.contextPath }/user/savepwd",
			     onSubmit: function(){
			         //进行表单验证
			         //如果返回false阻止提交
			    	 return $('#itemForm').form('validate');
			     },
			     success:function(returnedDate){
			    	 if(returnedDate=="success"){
	        			 $.messager.alert('修改密码','密码修改成功!','info');
	            	 }else{
	            		 $.messager.alert('修改密码',returnedDate,'info');
	            	 }
			     }
			 });
	       });
	 });
	 
</script>
</head>
<body>
	<form:form id="itemForm" method="POST" modelAttribute="user">
		<br/><br/><br/><br/>
		<table width="320px" border=0 align="center">
			<input type="hidden" value="${vUser.userId}" name="userId">
			<tr>
				<td align="right">用户名称:&nbsp;</td>
				<td>
						<input type="text" value="${vUser.username}" readonly="readonly"/>
				</td>
			</tr>
			
			<tr>
				<td align="right">登录账号:&nbsp;</td>
				<td>
						<input type="text" value="${vUser.usercode}" readonly="readonly"/>
				</td>
				
			</tr>
			<tr>
				<td align="right">登录密码:&nbsp;</td>
				<td>
						<input type="password" name="password" class="easyui-validatebox" validType="pwdLength[6,12]" />
				</td>
				
			</tr>
			<tr>
				<td align="right">请输入新密码:&nbsp;</td>
				<td>
						<input type="password" name="newPwd" id="pwd" class="easyui-validatebox" validType="pwdLength[6,12]" />
				</td>
				
			</tr>
			<tr>
				<td align="right">请重输新密码:&nbsp;</td>
				<td>
						<input type="password" name="newPwd" class="easyui-validatebox" validType="rpwdLength"/>
				</td>
				
			</tr>
			
		</table>
		<br/>
		<div align="center">
			<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-save'" id="submit">提交</a>
		</div>

	</form:form>
</body>

</html>